UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wx/SPi/4u+JNLUm2hWx4y8o7FS5/NiIcd14GkvbUkOU=' 
WHERE 
  key_id = '1f0244daff057660ec08f234ef1527b80a2704cadb6b944e2eb2badc90845968' 
  AND (
    token = 'wx/SPi/4u+JNLUm2hWx4y8o7FS5/NiIcd14GkvbUkOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047