UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ek163ar1ZP0NO8OlB5LUlqxD+JlbpcDfLCw6DObmZ3Y=' 
WHERE 
  key_id = 'e64a609503f670528126d56b9a8d1703a04f3745c7d28b16cfc8c34cbe5acc2f' 
  AND (
    token = 'ek163ar1ZP0NO8OlB5LUlqxD+JlbpcDfLCw6DObmZ3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026