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