UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XkVwHGzjvaQdR2mypTx6y6NFYRQiGNj8UDcS5jxtPZk='
WHERE
key_id = '0db02fe8e987e2310e4e00eddd1a1864e3e6c6b89063efd8f16f480e0f6cb45b'
AND (
token = 'XkVwHGzjvaQdR2mypTx6y6NFYRQiGNj8UDcS5jxtPZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)