UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nNdzakcXXitBqgW54rGqygiRJXD7HjNSk5Rcy+VG9ME='
WHERE
key_id = '8fe975dc3142d90bc325902be295c2df3bb1e7c17141cbd44609b31aae786e61'
AND (
token = 'nNdzakcXXitBqgW54rGqygiRJXD7HjNSk5Rcy+VG9ME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)