UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AHLge1Ah5+gDhnmalZUVCrCPyp6FG1rdep79iu3HMCs='
WHERE
key_id = 'b5e4c81d0bec460ff2486649222dc046385728e5cf3458887807ecec9cc58533'
AND (
token = 'AHLge1Ah5+gDhnmalZUVCrCPyp6FG1rdep79iu3HMCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)