UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1TT0rtMWjRvosdJHAikmpWz3XB0CGXTDObVuFHdmWA='
WHERE
key_id = 'f7e5884240012d6d53be482aae0622c06c428ba840c68990c610760e6d225998'
AND (
token = 'v1TT0rtMWjRvosdJHAikmpWz3XB0CGXTDObVuFHdmWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)