UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MVcOQHK364dx+c5gmRgW1b7w6AxYxbxPilrGFtP+Tn0=' 
WHERE 
  key_id = '4578fb1055d1b520e1901774b35c333236b882aea2ad3ed40856a2ba75112f67' 
  AND (
    token = 'MVcOQHK364dx+c5gmRgW1b7w6AxYxbxPilrGFtP+Tn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021