UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L8e6ZHdqZz3GnhP5TpasWqX1t8PMNa1w6r4GsBtjNI8='
WHERE
key_id = '6b0c5e295eab0712c67cac19d8d74834de751150cd570914f75a1fc80759c33a'
AND (
token = 'L8e6ZHdqZz3GnhP5TpasWqX1t8PMNa1w6r4GsBtjNI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)