UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3m74Rb5a5pHeC7Ddbcd22H/DoGAcKVlIZFbpHZH3WeY='
WHERE
key_id = 'bff764f9f382855e30c714a397caf19bfc92fc531e032a1c5d8a7166808f76c8'
AND (
token = '3m74Rb5a5pHeC7Ddbcd22H/DoGAcKVlIZFbpHZH3WeY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)