UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jTYcSDLfMuIhW9j5pIcTub7xbyva3DtP71TWTCTfxCY=' 
WHERE 
  key_id = '778a8dbb8366006e0902794054ce268eb1619e736e624a4636bac20c06a54604' 
  AND (
    token = 'jTYcSDLfMuIhW9j5pIcTub7xbyva3DtP71TWTCTfxCY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017