UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSfwhkM/w4jn5gPObQ+NcH8DwqI+F9cqs29tGmVNwFU=' 
WHERE 
  key_id = '3b0386863ab10527c251c536d1f503ad2ca55fbe49879ec819fff7e171efdb68' 
  AND (
    token = 'gSfwhkM/w4jn5gPObQ+NcH8DwqI+F9cqs29tGmVNwFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037