UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bXXIvlMMpqagLEcg59MWT5OrEuewpZ7POnznN+NJ1LU='
WHERE
key_id = '27fa96cd86144b812ce9b4e1c7f69766fd07b3d913f609c12e75e5c549fe579c'
AND (
token = 'bXXIvlMMpqagLEcg59MWT5OrEuewpZ7POnznN+NJ1LU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)