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

Query time 0.00045