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