UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a55lZmdR+hv8pTg8snfaD+fxlSXTRC2nJsJSVsy3j/c='
WHERE
key_id = 'd3df9624920397957ebfb59da7c75ca0015b59ff1ee2810c080f9122b87d50a5'
AND (
token = 'a55lZmdR+hv8pTg8snfaD+fxlSXTRC2nJsJSVsy3j/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)