UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h37PeOZyr099kcqH12rB6Iz9z6AP2zxl677BTs4lrws=' 
WHERE 
  key_id = '7844ca8fce70acf7621dbc8a869d922c098192a520ab80fd680f94363dce336d' 
  AND (
    token = 'h37PeOZyr099kcqH12rB6Iz9z6AP2zxl677BTs4lrws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031