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