UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D146n1WCvk7gHMwv1fyBQrml7UMo6tuLD81r5FslG94='
WHERE
key_id = '36f132195e406e49be338ea4d403cf65bc47df9958bc0a055d4f4a2beb1ac1ba'
AND (
token = 'D146n1WCvk7gHMwv1fyBQrml7UMo6tuLD81r5FslG94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)