UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dnUbGbyuWxHKupyIbOrwhJiDH5rPzrHl5JxCSErhakM='
WHERE
key_id = '1db65f7e0cc74aa0d338640e245c169fad9345ac27731ab37c188dbefe701597'
AND (
token = 'dnUbGbyuWxHKupyIbOrwhJiDH5rPzrHl5JxCSErhakM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)