UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GLjDdMfCkXAX/ZnUBDGUxc5g+3vcZz5WnT0fUtoibas=' 
WHERE 
  key_id = 'd554cf7d70b265d93d569100c2c23982849dc64bec2fea0bd64086219afa8881' 
  AND (
    token = 'GLjDdMfCkXAX/ZnUBDGUxc5g+3vcZz5WnT0fUtoibas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028