UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vDocM2RGRmnamGYiEzJDDCWLopWS9OK89cQn/ZVbbDo=' 
WHERE 
  key_id = '4142b585347309942182cf7655d2e2c12a843018d9ee8050ed6ae4a661fabb5f' 
  AND (
    token = 'vDocM2RGRmnamGYiEzJDDCWLopWS9OK89cQn/ZVbbDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030