UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tNO61YiW4qzQ6V5pqTltv9/eVbXvxG2OEe9tiV1OwCc='
WHERE
key_id = 'fd492f9cfdb31becd74df773d2760ab7649c9f1bcd60eee579f4d57c6fa761ab'
AND (
token = 'tNO61YiW4qzQ6V5pqTltv9/eVbXvxG2OEe9tiV1OwCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)