UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYQyGahC0DsLaVnZyZqVFVWRrqjw+sCxBvmxoO1nmRc=' 
WHERE 
  key_id = '27a15787047f3db069f67c7b59583e2e38c2491aa3ad35b645ee37b3693ddc5f' 
  AND (
    token = 'xYQyGahC0DsLaVnZyZqVFVWRrqjw+sCxBvmxoO1nmRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029