UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Doq55r99zTZPi/H3KE7t7Ew7mK5BETXr0YNcnJQyLFI=' 
WHERE 
  key_id = 'b1153c27dc72d09eac5560cf7d63356951486593d5b789d435e8544a20e12544' 
  AND (
    token = 'Doq55r99zTZPi/H3KE7t7Ew7mK5BETXr0YNcnJQyLFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042