UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RTlCJdEULbidZQvSWiN2CAb3QLWrO4E00E3bpkAvhh4='
WHERE
key_id = 'd1259680761b5e7c7f197c20426cb365a9b93f4ae075087d72cee077aa79cd68'
AND (
token = 'RTlCJdEULbidZQvSWiN2CAb3QLWrO4E00E3bpkAvhh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)