UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O7L+ydDobdTb94WUB0zFJPuCcc2sCU58WOl1zEYlsVE=' 
WHERE 
  key_id = '062ec02828bcb33e320bc9361e3b136cdbb44ca7d41d2a54ba79f7713a4360b2' 
  AND (
    token = 'O7L+ydDobdTb94WUB0zFJPuCcc2sCU58WOl1zEYlsVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053