UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qGGKiBUvn63k1JZDMvY+YSGu2+EnC22ZLdlaHMWXLt8='
WHERE
key_id = 'a757f4ea1eca28f874048be78743c7c308bb13edf7f1878761e024bafc2ca958'
AND (
token = 'qGGKiBUvn63k1JZDMvY+YSGu2+EnC22ZLdlaHMWXLt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)