UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zzZEUcDhKbh/6NAk5MMoMSpbjnp+VM9lme4VoES1baY=' 
WHERE 
  key_id = '0520d38d986b4db6e077c33b57f28164f88b195ca85c10e379a6a0937fbc87da' 
  AND (
    token = 'zzZEUcDhKbh/6NAk5MMoMSpbjnp+VM9lme4VoES1baY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042