UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LQwwGJPkDIWuQqY6unmuGB3mxsH3NFmNHzDJMEGi8bM=' 
WHERE 
  key_id = 'f68165fa6c47917460a4c714017093cfec8f898b483838ebe87fd97ad76ee925' 
  AND (
    token = 'LQwwGJPkDIWuQqY6unmuGB3mxsH3NFmNHzDJMEGi8bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032