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