UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+6a4Z7ltN3psO2jxL7T72xLBSEzdFjHtnKHqXkT2aY=' 
WHERE 
  key_id = '36fa7cda863d404b8ea2ac9cf05b4aaaf44d1e297710ccddc4edef14bfb4c1c1' 
  AND (
    token = '5+6a4Z7ltN3psO2jxL7T72xLBSEzdFjHtnKHqXkT2aY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025