UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PSmOwTqj0SDsAvR+hdrKT6oW65qosWkMLr+rImqOtPM='
WHERE
key_id = '007b7c72c634c99b51c0a39822cc133ecbc0a4e287926254b054cc7c42a6999f'
AND (
token = 'PSmOwTqj0SDsAvR+hdrKT6oW65qosWkMLr+rImqOtPM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)