UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBHsbwFP4WbHyJygz+zuXmQxUsBsRS9wbbzdOHhVxQU=' 
WHERE 
  key_id = '4df4ee7c49eff246e2839977c3df2adbd4e87370741bdf77cc5d26ca327fe20e' 
  AND (
    token = 'gBHsbwFP4WbHyJygz+zuXmQxUsBsRS9wbbzdOHhVxQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028