UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XA/WqaNOQ1PfYtZ33O7Jda1SEJ70B1yglnUNPFk5YYw='
WHERE
key_id = 'ff81c8a5a81218e764d07c03972cc68a987b99a418d5d353ac49578250c3f379'
AND (
token = 'XA/WqaNOQ1PfYtZ33O7Jda1SEJ70B1yglnUNPFk5YYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)