UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYbCqZy+p2V6/rAP2vPN0YRYNU34tp7kH86PhBUZ8vc=' 
WHERE 
  key_id = '27b7427a954c04ce8d03af6cb408bed933f60b86de13d891165dbddefad38730' 
  AND (
    token = 'kYbCqZy+p2V6/rAP2vPN0YRYNU34tp7kH86PhBUZ8vc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062